﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;

namespace StoreApp
{
    public class PaySystemImpl : IPaySystem
    {
        private IDbManger m_manager;

        public PaySystemImpl(IDbManger manager)
        {
            m_manager = manager;
        }

        public void IncreaseProfit(int cash) 
        {
            if (cash < 0)
                throw new ArgumentOutOfRangeException("cash < 0");

            Stopwatch watch = new Stopwatch();
            watch.Start();
            m_manager.Insert(cash);
            watch.Stop();
            Console.Out.WriteLine(TimeSpan.FromMilliseconds(watch.ElapsedMilliseconds).ToString("g"));
        }
    }
}
